using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class UserPropertyNames
  {
    public const string UserId = @"UserId"; 

    public const string UserName = @"UserName"; 

    public const string Password = @"Password"; 

  }

  public static class UserReferenceNames
  {
    public const string Roles = @"Roles"; 

    public const string Groups = @"Groups"; 

    public const string CreatedSubjects = @"CreatedSubjects"; 

    public const string EditedSubjects = @"EditedSubjects"; 

  }

  [Serializable]
  public partial class UserLoadSettings 
  {

    public UserLoadSettings()
    {
      AsReadonly = false;

      OnCreate();
    }

    public bool AsReadonly { get; set; }

    private UserFilterExpression filter;
    public UserFilterExpression Filter 
    { 
      get 
      { 
        filter = UserFilterExpression.FromUserFilterExpression(filter);
        return filter; 
      }
      set { filter = value; }
    }

    private UserSelectionSettings selection;
    public UserSelectionSettings Selection 
    { 
      get 
      { 
        selection = UserSelectionSettings.FromUserSelectionSettings(selection);
        return selection; 
      }
      set { selection = value; }
    }

    private UserInclusionSettings inclusion;
    public UserInclusionSettings Inclusion 
    { 
      get 
      { 
        inclusion = UserInclusionSettings.FromUserInclusionSettings(inclusion);
        return inclusion; 
      }
      set { inclusion = value; }
    }

    private UserSortingSettings sorting;
    public UserSortingSettings Sorting 
    { 
      get 
      { 
        sorting = UserSortingSettings.FromUserSortingSettings(sorting);
        return sorting; 
      }
      set { sorting = value; }
    }

    private PagingSettings paging;
    public PagingSettings Paging 
    { 
      get 
      { 
        if (paging == null) paging = new PagingSettings();
        return paging; 
      }
      set { paging = value; }
    }

    partial void OnCreate();

    protected virtual void CopyFrom(UserLoadSettings other)
    {
      if (other != null)
      {
        filter     = other.filter;
        selection  = other.selection;
        sorting    = other.sorting;
        inclusion  = other.inclusion;
        paging     = other.paging;
      }
    }

    public static UserLoadSettings FromUserLoadSettings(UserLoadSettings other)
    {
      if (other != null) return other;
      var result = new UserLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class UserFilterExpression 
  {
    public UserKey ByKey { get; set; }

    public int? Skip { get; set; }

    public int? Take { get; set; }

    public SimpleFilterExpression<Guid> UserIdFilter { get; set; }

    public SimpleFilterExpression<string> UserNameFilter { get; set; }

    public SimpleFilterExpression<string> PasswordFilter { get; set; }

    partial void OnCreate();

    protected virtual void CopyFrom(UserFilterExpression other)
    {
      if (other != null)
      {
        ByKey = other.ByKey;
        Skip = other.Skip;
        Take = other.Take;
      }
    }

    public static UserFilterExpression FromUserFilterExpression(UserFilterExpression other)
    {
      if (other != null) return other;
      var result = new UserFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class UserSelectionSettings 
  {
    public UserSelectionSettings()
    {
      SelectUserId = true;
      SelectUserName = true;
      SelectPassword = true;

      OnCreate();
    }

    public bool SelectUserId { get; set; } 

    public bool SelectUserName { get; set; } 

    public bool SelectPassword { get; set; } 

    partial void OnCreate();

    protected virtual void CopyFrom(UserSelectionSettings other)
    {
      if (other != null)
      {
        SelectUserId = other.SelectUserId;
        SelectUserName = other.SelectUserName;
        SelectPassword = other.SelectPassword;
      }
    }

    public static UserSelectionSettings FromUserSelectionSettings(UserSelectionSettings other)
    {
      if (other != null) return other;
      var result = new UserSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class UserInclusionSettings 
  {
    public UserInclusionSettings()
    {
      OnCreate();
    }

    public bool IncludeRoles { get; set; }
    private RoleLoadSettings includedRolesSettings;
    public RoleLoadSettings IncludedRolesSettings 
    { 
      get
      {
        includedRolesSettings = RoleLoadSettings.FromRoleLoadSettings(includedRolesSettings);
        return includedRolesSettings;
      } 
      set
      {
        includedRolesSettings = value;
      }
    }

    public bool IncludeGroups { get; set; }
    private GroupLoadSettings includedGroupsSettings;
    public GroupLoadSettings IncludedGroupsSettings 
    { 
      get
      {
        includedGroupsSettings = GroupLoadSettings.FromGroupLoadSettings(includedGroupsSettings);
        return includedGroupsSettings;
      } 
      set
      {
        includedGroupsSettings = value;
      }
    }

    public bool IncludeCreatedSubjects { get; set; }
    private SubjectLoadSettings includedCreatedSubjectsSettings;
    public SubjectLoadSettings IncludedCreatedSubjectsSettings 
    { 
      get
      {
        includedCreatedSubjectsSettings = SubjectLoadSettings.FromSubjectLoadSettings(includedCreatedSubjectsSettings);
        return includedCreatedSubjectsSettings;
      } 
      set
      {
        includedCreatedSubjectsSettings = value;
      }
    }

    public bool IncludeEditedSubjects { get; set; }
    private SubjectLoadSettings includedEditedSubjectsSettings;
    public SubjectLoadSettings IncludedEditedSubjectsSettings 
    { 
      get
      {
        includedEditedSubjectsSettings = SubjectLoadSettings.FromSubjectLoadSettings(includedEditedSubjectsSettings);
        return includedEditedSubjectsSettings;
      } 
      set
      {
        includedEditedSubjectsSettings = value;
      }
    }


    partial void OnCreate();

    protected virtual void CopyFrom(UserInclusionSettings other)
    {
      if (other != null)
      {
        IncludeRoles = other.IncludeRoles;
        includedRolesSettings = other.includedRolesSettings;
        IncludeGroups = other.IncludeGroups;
        includedGroupsSettings = other.includedGroupsSettings;
        IncludeCreatedSubjects = other.IncludeCreatedSubjects;
        includedCreatedSubjectsSettings = other.includedCreatedSubjectsSettings;
        IncludeEditedSubjects = other.IncludeEditedSubjects;
        includedEditedSubjectsSettings = other.includedEditedSubjectsSettings;
      }
    }

    public static UserInclusionSettings FromUserInclusionSettings(UserInclusionSettings other)
    {
      if (other != null) return other;
      var result = new UserInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class UserSortingSettings 
  {
    public UserSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected virtual void CopyFrom(UserSortingSettings other)
    {
      if (other != null)
      {
      }
    }

    public static UserSortingSettings FromUserSortingSettings(UserSortingSettings other)
    {
      if (other != null) return other;
      var result = new UserSortingSettings();
      return result;
    }

  }
}
